<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>评论列表</title>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    {CSS href="__ADDONSTATIC__css/font.css" /}
    {CSS href="__ADDONSTATIC__css/xadmin.css" /}
    {js href='__ADDONSTATIC__js/jquery-3.2.1.min.js' /}

    {js href='__ADDONSTATIC__js/xadmin.js' /}
    {js href='__ADDONSTATIC__js/util.js' /}
    {js href='__ADDONSTATIC__lib/layui/layui.js' /}
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-body" id="page">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="{:addonUrl('Evaluate/pagelist')}?page={$page}">
            <input id="name" type="text" name="name"  placeholder="请输入项目名" autocomplete="off" value="{$name}"
                   class="layui-input">
            <div class="layui-input-inline">
                <select id="stage" name="stage">
                    <option value="" selected>阶段</option>
                    <option value="0" {if condition="$stage == '0'"}selected{/if}>样板房</option>
                    <option value="1" {if condition="$stage == 1"}selected{/if}>前期进场</option>
                    <option value="2" {if condition="$stage == 2"}selected{/if}>前期施工</option>
                    <option value="3" {if condition="$stage == 3"}selected{/if}>施工过程</option>
                    <option value="4" {if condition="$stage == 4"}selected{/if}>施工收尾</option>
                    <option value="5" {if condition="$stage == 5"}selected{/if}>售后维修</option>
                </select>
            </div>
            <div class="layui-input-inline">
                <input type="number" id="year" name="year" class="layui-input" placeholder="年份" value="{$year}">
            </div>
            <div class="layui-input-inline">
                <input type="number" id="week" name="week" class="layui-input" placeholder="周数" value="{$week}">
            </div>
            <div class="layui-input-inline">
                <select id="status" name="status">
                    <option value="" selected>评价状态</option>
                    <option value="1" {if condition="$status == '1'"}selected{/if}>满意</option>
                    <option value="0" {if condition="$status == '0'"}selected{/if}>不满意</option>
                    <option value="null" {if condition="$status == 'null'"}selected{/if}>未评价</option>
                </select>
            </div>
            <button type="submit" lay-filter="search" lay-submit="" class="layui-btn"><i class="layui-icon">&#xe615;</i></button>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href.slice(0,location.href.indexOf('mid')+5));" title="刷新">
                <i class="layui-icon" style="line-height:30px">ဂ</i></a>
        </form>
    </div>
    <xblock>
    <button style="float:right" class="layui-btn" onclick="exportExcel()">导出excel</button>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>序号</th>
            <th>评价编号</th>
            <th>项目名称
            <th>坐落位置</th>
            <th>阶段</th>
            <th>第几周</th>
            <th>甲方评价人</th>
            <th>评价总状态</th>
            <th>不满意项目</th>
            <th>备注</th>
            <th>操作</th>
        </thead>
        <tbody>
        {volist name='list' id='l'}
        <tr>
            <td>{$i+($page-1)*10}</td>
            <td>{$l.id}</td>
            <td style="cursor:pointer" title="{$l.p_name}" onclick="x_admin_show('解决方案','{:addonUrl('Solve/evaluateSolveList')}?eId={$l.id}')">{$l.p_name|subtext=20}</td>
            <td>{$l.p_position}</td>
            <td>
                {switch name="l.stage" }
                {case value="0" }样板房{/case}
                {case value="1" }前期进场{/case}
                {case value="2" }前期施工{/case}
                {case value="3" }施工过程{/case}
                {case value="4" }施工收尾{/case}
                {case value="5" }售后维修{/case}
                {default/}无
                {/switch}
            </td>
            <td>{$l.week}</td>
            <td>{$l.m_name}</td>
            <td>{$l.status}</td>
            <td>{$l.evaluateInfo|getBadEvaluateKey}</td>
            <td>{$l.remark}</td>
            <td class="td-manage">
                <!--<a title="编辑" onclick="x_admin_show('编辑','{:addonUrl('Evaluate/updatepage')}?id={$l.id}')" href="javascript:;">-->
                    <!--<i class="layui-icon">&#xe642;</i>-->
                <!--</a>-->
                <a title="删除" onclick="member_del({$l.id})" href="javascript:;">
                    <i class="layui-icon">&#xe640;</i>
                </a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <!--分页页面-->
    <?php echo $list->render() ?>
</div>

<script>

    /*用户-删除*/
    function member_del(id) {
        layer.confirm('确认要删除吗？', function (index) {
            //发异步删除数据
            ajaxUrl('{:addonUrl('Evaluate/delete')}', {id: id}, function (data) {
                console.log(data);
                if (data.code == 1) {
                    layer.msg('已删除!', {icon: 1, time: 1000});
                    location.reload();
                } else {
                    layer.msg(data.message);
                }
            })
        });
    }
    function exportExcel() {
        var data = {};
        data.name = $("#name").val();
        data.week = $("#week").val();
        data.year = $("#year").val();
        data.status = $("#status").val();
        data.stage = $("#stage").val();
        layer.load(2, {
            shade: [0.3, '#C1C1C1'] //0.1透明度的白色背景
        });
        ajaxUrl("{:addonUrl('Evaluate/exportExl')}",data,function (res) {
            layer.closeAll('loading');
            if (res.code && res.code == 1) {
                window.location.href = "/" + res.result;
            }else{
                layer.alert(res.message);
            }
        })
    }
</script>
</body>

</html>